
#include "DataStructure/Result/ResultDomains.h"

#include "DataStructure/Common/Validation.h"

using namespace SG::DataStructure::Post;

// 对比数据
bool SG::DataStructure::Post::operator== (const ResultDomains& val1, const ResultDomains& val2)
{
    FIELD_COMPARE (m_id)
    FIELD_COMPARE (m_Subcase)
    FIELD_COMPARE (m_Step)
    FIELD_COMPARE (m_Analysis)
    FIELD_COMPARE (m_TimeFrequencyEigr)
    FIELD_COMPARE (m_Eigi)
    FIELD_COMPARE (m_Mode)
    FIELD_COMPARE (m_DesignCycle)
    FIELD_COMPARE (m_Random)
    FIELD_COMPARE (m_SuperelementNumber)
    FIELD_COMPARE (m_AfpmId)
    FIELD_COMPARE (m_TrmcId)
    FIELD_COMPARE (m_Instance)
    FIELD_COMPARE (m_Module)
    FIELD_COMPARE (m_Substep)
    FIELD_COMPARE (m_ImperfectionId)

    return true;
}

AnalysisType SG::DataStructure::Post::ConvertSOLTypeToAnalysisType(const SG::DataStructure::FEM::SOLType& solType)
{
    switch (solType)
    {
        case SG::DataStructure::FEM::SOLType::SOL_SESTATIC:
            return AnalysisType::ANALYSISTYPE_Static;
        case SG::DataStructure::FEM::SOLType::SOL_SEMODES:
            return AnalysisType::ANALYSISTYPE_Modes;
        case SG::DataStructure::FEM::SOLType::SOL_SEDFREQ:
        case SG::DataStructure::FEM::SOLType::SOL_SEMFREQ:
        case SG::DataStructure::FEM::SOLType::SOL_CYCFREQ:
            return AnalysisType::ANALYSISTYPE_Frequency;
        case SG::DataStructure::FEM::SOLType::SOL_SEDTRAN:
        case SG::DataStructure::FEM::SOLType::SOL_SEMTRAN:
        case SG::DataStructure::FEM::SOLType::SOL_NLTRAN:
        case SG::DataStructure::FEM::SOLType::SOL_NLTRAN700:
        case SG::DataStructure::FEM::SOLType::SOL_NLTCSH:
            return AnalysisType::ANALYSISTYPE_DirectTransient;
        case SG::DataStructure::FEM::SOLType::SOL_SEBUCKL:
        case SG::DataStructure::FEM::SOLType::SOL_CYCBUCKL:
            return AnalysisType::ANALYSISTYPE_Buckl;
        case SG::DataStructure::FEM::SOLType::SOL_SEDCEIG:
        case SG::DataStructure::FEM::SOLType::SOL_SEMCEIG:
            return AnalysisType::ANALYSISTYPE_ComplexEigenvalues;
        case SG::DataStructure::FEM::SOLType::SOL_NLSTATIC:
        case SG::DataStructure::FEM::SOLType::SOL_NONLIN:
            return AnalysisType::ANALYSISTYPE_NonlinearStatics;
        case SG::DataStructure::FEM::SOLType::SOL_NLSCSH:
            return AnalysisType::ANALYSISTYPE_Heat;
        default:
            return AnalysisType::ANALYSISTYPE_Unknown;
    }
}
